#ifndef LOADMESSAGE_H
#define LOADMESSAGE_H

#include "QDebug"
#include "QThread"
#include "QDir"
#include "QDialog"
#include <QGraphicsDropShadowEffect>
#include <QMovie>
#include <QGridLayout>
#include <QLabel>
#include <QTimer>
#include "Code/net/net_pthread.h"

class LoadMessage : public QDialog
{
private:
    QRect *qr;
    Q_OBJECT

    int outTime;
    int nowTime;

    QLabel *labText;
    QWidget *widgetPtr;
    QGraphicsDropShadowEffect *shadow;
    QGridLayout *gridLayout;
    net_pthread *net;
signals:
    void create_fail();
    void create_post();
public:
    //加载弹窗方式构建,timeSec为自动关闭时间(单位:s)，-1表示不会自动关闭
    explicit LoadMessage (const QString &text,int timeSec = -1,QWidget *parent = nullptr);
    ~LoadMessage (){
        net->succeed_flag = true;
        net->wait();
        net->quit();
        delete net;
        this->close();

        disconnect(net,&net_pthread::trigger_main, this,&LoadMessage::run);

    }
public slots:
    void run();
};

#endif // LOADMESSAGE_H
